package com.huawei.hianalytics.ab.fg;

import android.content.Context;
import com.huawei.hianalytics.ab.bc.kl.cd;

public final class ab {
    private static final String[] ab = new String[]{"ABTesting", "_default_config_tag", "_openness_config_tag", "_hms_config_tag"};
    private static ab bc = null;
    private static final Object cd = new Object();
    private Context de;

    private ab() {
    }

    public static ab ab() {
        if (bc == null) {
            cd();
        }
        return bc;
    }

    private static synchronized void cd() {
        synchronized (ab.class) {
            if (bc == null) {
                bc = new ab();
            }
        }
    }

    public void ab(Context context) {
        synchronized (cd) {
            if (this.de != null) {
                com.huawei.hianalytics.ab.bc.ef.ab.cd("HiAnalyticsDataManager", "DataManager already initialized.");
                return;
            }
            this.de = context;
            com.huawei.hianalytics.ab.bc.cd.ab.ab.ab().cd().ab(this.de);
            com.huawei.hianalytics.ab.bc.cd.ab.ab.ab().cd().gh(context.getPackageName());
            com.huawei.hianalytics.ab.cd.bc.ab.ab().ab(context);
        }
    }

    public void ab(String str) {
        if (this.de == null) {
            com.huawei.hianalytics.ab.bc.ef.ab.cd("HiAnalyticsDataManager", "clearDataByTag() sdk is not init");
            return;
        }
        com.huawei.hianalytics.ab.bc.ef.ab.bc("HiAnalyticsDataManager", "HiAnalyticsDataManager.clearDataByTag(String appid) is execute.");
        com.huawei.hianalytics.ab.bc.ij.ab.cd(this.de, str);
    }

    public void bc() {
        com.huawei.hianalytics.ab.bc.ef.ab.bc("HiAnalyticsDataManager", "clearCachedData() is execute.");
        if (this.de == null) {
            com.huawei.hianalytics.ab.bc.ef.ab.cd("HiAnalyticsDataManager", "clearCachedData() sdk is not init");
            return;
        }
        com.huawei.hianalytics.ab.bc.ef.ab.bc("HiAnalyticsDataManager", "HiAnalyticsDataManager.clearCachedData() is execute.");
        com.huawei.hianalytics.ab.bc.ij.ab.ab(this.de, "stat_v2_1", new String[0]);
        com.huawei.hianalytics.ab.bc.ij.ab.ab(this.de, "cached_v2_1", new String[0]);
    }

    public void bc(String str) {
        com.huawei.hianalytics.ab.bc.ef.ab.bc("hmsSdk", "HiAnalyticsDataManager.setAppid(String appid) is execute.");
        if (this.de == null) {
            com.huawei.hianalytics.ab.bc.ef.ab.cd("hmsSdk", "sdk is not init");
            return;
        }
        com.huawei.hianalytics.ab.bc.cd.ab.ab.ab().cd().hi(cd.ab("appID", str, "[a-zA-Z0-9_][a-zA-Z0-9. _-]{0,255}", this.de.getPackageName()));
    }
}
